
#ifndef _MEMBER_BHINGERESTRAINT_H_
#define _MEMBER_BHINGERESTRAINT_H_

#include <BNode>
#include <BHingeRestraint>

#define hinge_member(hinge)		((member_BHingeRestraint*)((BHingeRestraint*)hinge)->_ptr)

namespace BWE
{
	class member_BHingeRestraint
	{
	public:
		member_BHingeRestraint(BHingeRestraint* restraint);
		~member_BHingeRestraint();
		
		void caculate();
		BReal motorFactor(BReal stepTime);

		BHingeRestraint*	boss;
		BVector			axisA;
		BVector			axisB;
		BVector			horAxis;
		BVector			verAxis;
		BVector			dirAxis;
		BVector			swingAxis;

		BReal			hingeAngle;
		BRealRange		angularLimit;
		bool			solveLimit;
		BReal			angleError;

		bool			motorEnabled;
		bool			motorReached;
		BReal			motorTarget;
		BReal			motorVelocity;
		BReal			motorMaxForce;
	};
}

#endif
